import cv2
from numpy import True_

# /Streaming/Channels/1
url = "rtsp://admin:jaya2018@192.168.0.202:554"
cap = cv2.VideoCapture(url)

isOpen = cap.isOpened()
print(f"------------------- {isOpen}") 
if isOpen != True_:
    print("------------------- 未能连接")
    exit

ret, frame = cap.read()
while ret:
    # 读取视频帧
    ret, frame = cap.read()
    # 显示视频帧
    cv2.imshow("frame", frame)
    #等候1ms,播放下一帧，或者按q键退出
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

#释放视频流
cap.release()
#关闭所有窗口
cv2.destroyAllWindows()